// 工具函数
function debounce(fn: Function, wait: number) {
  let timeout: any = null;
  return function () {
    if (timeout !== null)
      clearTimeout(timeout);
    timeout = setTimeout(fn, wait);
  }
}
function throttle(fn: Function, delay: number) {
  var timer: any = null;
  return function () {
    var context = this;
    var args = arguments;
    if (!timer) {
      timer = setTimeout(function () {
        fn.apply(context, args);
        timer = null;
      }, delay);
    }
  }
}
function isMobileOrPc(){
  if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    return true;
  } else {
    return false;
  }
}
export {debounce,throttle,isMobileOrPc}